//在这里进行商品详情页的数据请求
import { request } from "./request"

export function detail(iid) {

    return request({
        url: "/detail",
        params: {
            iid
        }

    })

}

//商品信息的推荐
export function recommend() {
    return request({
        url: "/recommend"
    })
}




//商品信息的类
export class goodsinfo {
    //这是构造方法
    constructor(iteminfo, columns, services) {
        this.title = iteminfo.title
        this.desc = iteminfo.desc
        this.newPrice = iteminfo.price
        this.oldPrice = iteminfo.oldPrice
        this.discount = iteminfo.discountDesc
        this.columns = columns
        this.services = services
        this.realPrice = iteminfo.lowNowPrice
    }

}



//店铺信息的类
export class shop {
    constructor(shopInfo) {
        this.logo = shopInfo.shopLogo
        this.name = shopInfo.name
        this.fans = shopInfo.cFans
        this.sells = shopInfo.cSells
        this.score = shopInfo.score
        this.goodscount = shopInfo.cGoods
    }
}


//导出商品尺寸
export class goodsparam {
    constructor(info, rule) {
        //有些商品没有info.image
        this.image = info.image ? info.image[0] : "";
        this.infos = info.set;
        this.sizes = rule.tables
    }
}